home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tp_dmx20.zip / DBENTRY.PAS < prev    next >
Pascal/Delphi Source File  |  1990-01-15  |  2KB  |  99 lines

  1. Program DBENTRY;
  2.  
  3. {$V-,I- }
  4.  
  5. (*
  6.        This program uses dBrowser, from the DMXdFILE unit.
  7.  
  8.        The DataAt function has been bypassed to get records from
  9.        the disk, one-at-a-time.  dBwindow, the descendant object,
  10.        uses a virtual method (SetUpRecord) to display the current
  11.        record number.
  12.  *)
  13.  
  14.  
  15. uses   Dos, Crt, DMX2, DMXdFILE;
  16.  
  17.  
  18. type
  19.        dBwindow    =  object (dBrowser)
  20.                         procedure SetUpRecord (RecNum : longint);
  21.                                   virtual;
  22.                       end;
  23.  
  24.  
  25. const
  26.       testfilename = 'base.dbf';
  27.  
  28.        maintitle   = ' Account                                   ref    balance';
  29.        baseformat  = ' CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC| CCC |($NNN,NNN.NN)';
  30.  
  31.        basesize    =  54 * 1000;  { database size limit (in characters) }
  32.  
  33.        Spc         =  #32;
  34.        cr          =  #13;
  35.  
  36.  
  37. var    Key,ext     :  char;
  38.  
  39.   (* Note that the record structure doesn't actually need to be declared. *)
  40.  
  41.        testdata    :  char;
  42.  
  43.   {  testdata is not actually accessed by DMX because the
  44.      internal functions are bypassed in DMXdFILE.PAS       }
  45.  
  46.        DataWindow  :  dBwindow;
  47.  
  48.  
  49.  
  50.   { ─────────────────────────────────────────────────────────────────────── }
  51.  
  52.  
  53. procedure dBwindow.SetUpRecord (RecNum : longint);
  54. { this virtual method displays the record number at the bottom of the screen }
  55. var  AStr : string;
  56. begin
  57.   Str (currentrec + 1:4, AStr);
  58.   Screen (AStr + '  ', 24,11, fieldcolor);
  59. end;
  60.  
  61.  
  62.   { ─────────────────────────────────────────────────────────────────────── }
  63.  
  64.  
  65. procedure WorkWindow (TopStr,FmtStr, Filename : pathstr);
  66. begin
  67.   TextAttr := $3B;
  68.   MkBorder (1,9, 25,71, LightCyan);
  69.   Window (10,2,70,24);
  70.   ClrScr;
  71.  
  72.   DataWindow.Init (TopStr, FmtStr, 2,2, $3B,$3F,$70);
  73.  
  74.   DataWindow.dBASEinit (testfilename);
  75.  
  76.   DataWindow.OpenBuffer (testdata, basesize);
  77.   DataWindow.EditData (testdata, Key,ext, [^C,#27],[]);
  78.  
  79.   DataWindow.dBASEclose;
  80. end;
  81.  
  82.  
  83.   { ─────────────────────────────────────────────────────────────────────── }
  84.  
  85.  
  86. Begin
  87.   BeepOn   := True;
  88.   TextAttr := LightCyan;
  89.   ClrScr;
  90.  
  91.   WorkWindow (maintitle, baseformat, testfilename);
  92.  
  93.   TextAttr := LightCyan;
  94.   Window (1,1,80,25);
  95.   ClrScr;
  96.   GotoXY (1,4);
  97. End.
  98.  
  99.